<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    let obj = {
        name: "张三",
        age: 20,
        aderr: '成都'
    }
    obj[Symbol.iterator] = function () {
        let index = 0;
        let keys = Object.keys(obj);
        return {
            next: () => {
                let key = keys[index++];
                let val = obj[key];
                if (index <= keys.length) {
                    return { value: val, done: false }
                } else {
                    return { value: undefined, done: true }
                }
            }
        }
    }
    for (a of obj) {
        console.log(a)
    }

    let ob = obj[Symbol.iterator]();
    console.log(ob.next());
    console.log(ob.next());
    console.log(ob.next());

</script>